<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="Public:meta" />
    <style>
		#datatable .tdPluginName{font-family:'Microsoft YaHei',Tahoma,Verdana,'Simsun';text-align:left; padding-left:5px;}
		.datatable .PluginPicture{ width:80px; height:80px; border:0; margin:8px;}
    	.datatable .PluginName{}
		.datatable .PluginName a,.datatable .PluginName{color:#09F; font-size:17px; font-weight:bold;  }
		.datatable .PluginName a:hover{ color:#F30; text-decoration:none;}
		.datatable .PluginPrice{ color:red; font-size:14px;}
		.datatable p{ color:#222; font-size:14px;}
    </style>
</head>
<body id="main_page">
<include file="Public:position" />
<div class="container">
    <form enctype="multipart/form-data" method="post" id="frm">
      <div class="table">
        <div class="toolbars">          
             <li class="toolbar"><a id="sortall" onclick="sort()" title="批量排序">排序</a></li>
        </div>
        <table class="datatable" id="datatable">
            <tr>
                <th width="90px" >图标</th>
                <th>插件名称</th>
                <th width="60px">排序</th>
                <th width="70px">版本</th>
                <th width="90px">作者</th>
                <th width="70px" >是否启用</th>
            </tr>
            <notempty name="Data">
                <volist name="Data" id="d">
                    <tr>
                        <td>
                            <notempty name="d.PluginUrl">
                                <a href="{$d.PluginUrl}" target="_blank"><img class="PluginPicture" src="{$Images}{$d.PluginPicture}"/></a>
                            <else/>
                                <img class="PluginPicture" src="{$Images}{$d.PluginPicture}"/>
                            </notempty>
                        </td>
                        <td class="tdPluginName">
                            <div class="PluginName">
                                <notempty name="d.PluginUrl">
                                	<a href="{$d.PluginUrl}" target="_blank">{$d.PluginName}</a>
                                <else/>
                                	{$d.PluginName}
                                </notempty>
                            </div>
                            <div class="PluginPrice">{$d.PluginPrice}</div>
                            <p>{$d.PluginDescription}</p>
                        </td>
                        <td>
                                <input type="text" class='textinput' onclick="this.select()" style="width:50px" name="PluginOrder[]" value="{$d.PluginOrder}" />
                                <input type="hidden" class='textinput' name="PluginOrderID[]" value="{$d.PluginID}" />
                        </td>
                        <td>{$d.PluginVersion}</td>
                        <td style="color:blue;">{$d.PluginAuthor}</td>
                        <td>
                            <eq name="d.IsEnable" value="1">
                                <span class="IsEnable" PluginID="{$d.PluginID}" IsEnable="0"  style="color:black;cursor:pointer; ">启用</span>
                            <else/>
                                <span class="IsEnable" PluginID="{$d.PluginID}" IsEnable="1"  style="color:red;cursor:pointer; ">禁用</span>
                            </eq>
                       </td>
                    </tr>
                </volist>  
            <else/>
                <tr><td colspan="5" id="NoData">{$Think.lang.NoDataTip}</td></tr>
            </notempty>                              
        </table>
         <div class="tfoot">
              <div id="notice">
                    <b>说明：</b><span class="notice-item">可以选择启用和禁用插件，禁用插件后，将不会显示在我的插件列表中</span>
              </div>
         </div>
    </div>
  </form>
</div>
</body>
</html>
<script type="text/javascript">
//排序
function sort(){
	LoadBox("排序中，请稍后...");
	$('#frm').attr("action", "__URL__/sort");
	$("#frm").ajaxSubmit( {
		success: function(){
			CloseLoadBox();
			RefreshLeftFrame();
			window.location.reload();
		}, 
		dataType: 'json'
	} );
	return false;
}	

$(document).ready(function(e) {
	$(".IsEnable").click(function(){
			LoadBox("设置中，请稍后...");
			var that = this;
			var url = "{$Url}enable";
			var PluginID = $(that).attr("PluginID");
			var IsEnable = $(that).attr("IsEnable");
			var params = {
					PluginID : PluginID,
					IsEnable : IsEnable
			};
			$.post(url, params, function(data){
				CloseLoadBox();
				if(data.status==1){
					if(IsEnable==1){
						$(that).text("启用");
						$(that).attr("IsEnable",0);
						$(that).css("color", "#000");
					}else{
						$(that).text("禁用");
						$(that).attr("IsEnable",1);
						$(that).css("color", "#F00");
					}
					RefreshLeftFrame();
				}
			},"json");
	});
});
</script>